package com.spzx.user.api;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.user.api.domain.UpdateUserLogin;
import com.spzx.user.api.domain.UserInfoDto;
import com.spzx.user.api.factory.RemoteUserInfoFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 会员管理
 *
 * @author gaozz
 */
@FeignClient(contextId = "remoteUserInfoService",
        value = ServiceNameConstants.USER_SERVICE,
        fallbackFactory = RemoteUserInfoFallbackFactory.class)
public interface RemoteUserInfoService {

    @PostMapping("/userInfo/register")
    R<Boolean> register(@RequestBody UserInfoDto userInfo,
                        @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/userInfo/info/{username}")
    R<UserInfoDto> getUserInfo(@PathVariable("username") String username,
                               @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PutMapping("/userInfo/updateUserLogin")
    R<Boolean> updateUserLogin(@RequestBody UpdateUserLogin updateUserLogin,
                               @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
